cmake_minimum_required(VERSION 3.8)
project(tasks)

set(CMAKE_CXX_STANDARD 20)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(std_msgs REQUIRED)
find_package(general_interface REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(control-algorithm REQUIRED)
find_package(rclpy REQUIRED)

add_executable(connect_task src/connect_task.cpp)
ament_target_dependencies(connect_task rclcpp rclcpp_action general_interface tf2_ros Eigen3)
target_link_libraries(connect_task control_algorithm)
install(TARGETS connect_task RUNTIME DESTINATION lib/${PROJECT_NAME})

add_executable(disconnect_task src/disconnect_task.cpp)
ament_target_dependencies(disconnect_task rclcpp rclcpp_action general_interface)
install(TARGETS disconnect_task RUNTIME DESTINATION lib/${PROJECT_NAME})

#install(
#  DIRECTORY launch/
#  DESTINATION share/${PROJECT_NAME}/launch
#)

# Install Python scripts
ament_python_install_package(${PROJECT_NAME})
install(
  PROGRAMS
  scripts/action.py
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()
